-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update asn1 files #17
Conversation
|
||
namespace jam { | ||
|
||
template <typename T, typename = std::enable_if<std::is_scalar_v<T>>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use Foo = Tagged<T>
instead of struct Foo { T v }
?
Why inherit Tagged<T> : T {}
instead of Tagged<T> { T v }
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use Foo = Tagged instead of struct Foo { T v }?
Composition hides public members, and developers have to have access to them over composed member. It makes code a bit noisy and non clear. Tagged types more transparent.
Why inherit Tagged : T {} instead of Tagged { T v }?
Same explanation. But additionally for POD type is used zero-cost Wrapper.
/// Special zero-size-type for some things | ||
/// (e.g., dummy types of variant, unsupported or experimental). | ||
template <size_t N> | ||
using Unused = Tagged<Empty, NumTag<N>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate struct, not related to Empty
(encode/decode)
using Unused = Tagged<Empty, NumTag<N>>; | |
struct Unused {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. std::variant can not contain two same type. Tagged type resolves this disadvantage.
#include <test-vectors/vectors.hpp> | ||
|
||
namespace jam::test_vectors_disputes { | ||
namespace jam::test_vectors::disputes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespace test_vectors_disputes
was intentional, to avoid
"no type/function foo
in namespace disputes
, did you mean jam::disputes::foo
or jam::test_vectors::disputes::foo
" error
.tau = tau_tick, | ||
.eta = {eta_tick_0, eta_tick_1, eta_tick_2, eta_tick_3}, | ||
.lambda = lambda_tick, | ||
.kappa = kappa_tick, | ||
.gamma_k = gamma_tick_k, | ||
// TODO(turuslan): #3, wait for test vectors | ||
.iota = iota, | ||
.gamma_a = gamma_tick_a, | ||
.gamma_a = {gamma_tick_a.begin(), gamma_tick_a.end()}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.gamma_a = {gamma_tick_a.begin(), gamma_tick_a.end()}, | |
.gamma_a = asVec(gamma_tick_a), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be wrong, but I think in my implementation vector emplaced by iterators, but asVec
creates temporary vector and moves it.
Update code of parsing asn1 files in according with changes of jam-test-vectors.
Fix safrol test.